home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Floppyshop 2
/
Floppyshop - 2.zip
/
Floppyshop - 2.iso
/
art&graf.ix
/
art-4543
/
mvg
/
mod_code
/
mod_info.txt
< prev
next >
Wrap
Text File
|
1987-04-21
|
6KB
|
148 lines
A Module has two ways to obtain information from MVG 1.3
Any method can be used alone. Most can be mixed and matched,
although at this time I don't know why you should bother.
1) Manual contruction: this is the original method as used in MVG v1.2
It requires that you copy the Packet Table from
MVG's data space into your module. The Packet
is a bit disorganized, mixing varibles' addresses
with subroutine entry points; but it is kept
to maintain compatiblity with v 1.2.
2) Minimal Hassle: a set of function calls using a method
similar to that used in GEMDOS calls.
All methods require that the module can locate its parent's basepage
address, and thereby locate the parent's command line (basepage+$0080).
MVG's commandline will contain the following 3 items, each is four bytes wide
a) Packet Address 32 bit word: $nnnnnnnn
b) MVG Signature ascii codes: $00, $4D, $56, $47 ( 0,"MVG")
c) Version signature ascii codes: $31, $2e, $30, (??) ("1.3",??)
a) Address of Packet List: THIS IS WHERE YOU'LL FIND THE GOODIES!
b) MVG Signature must be located!
c) sub signature denotes version number. last char is sub_ver letter.
Packet List Pointer (item #a, in MVG commandline)
This address points to the original Packet List (as defined in v1.2).
Each item in the list is 4 bytes wide (ie a long word). Items are
either a variables address in MVG's space or the entry point for a
subroutine within MVG.
The first two items do not follow the above definition. They are direct!
item 0: MAIN_BUFFER Address. This is a pointer to the main image buffer.
Unlike the other items which can be modified, this one cannot.
item 1: BUFFER_LEN Variable. This is the size, in bytes, of the above
addressed buffer. This, also, cannot be modified.
All other items are POINTERS to either Variables or Routines. You can
modify the value found at the item's directed address:
-------------------------------------------------------------------------
Sample Sample Sample Sample Sample Sample Sample Sample Sample Sample
-------------------------------------------------------------------------
Item #z: Image_Height.W : $002CE428
at address $002CE428 is where you'll find the Height of the current
image in memory.
at $002CE428 we find the value $0190 (400 decimal)
we can reduce the image's height by simply replacing the $0190
with a smaller value. When MVG regains control, it will think
that the image is shorter.
Item #e: AnyKey : $00301990
address $00301990 is the entrypoint for the subroutine ANYKEY
calling this address (ANYKEY) will wait for a keypress and
return the keycode in D0.L ; you can use it for input or simply
as a pausing method.
-------------------------------------------------------------------------
The Packet List Pointer, as said earlier, points to the start of the Packet.
Each item is an offset from this start (item_number * 4).
At offset -4 is the address for method#2 calls (PACK2_FUNC)
At offset -8 is the address for method#3 calls (not implemented in 1.3)
At offset -12 is the address of MOD_RETURN_VALUES_INT (unused in 1.3)
At offset -16 is the address of MOD_RETURN_VALUES_ADR (unused in 1.3)
Method #1 requires that your module copy the packet list into it's own
memory space and build it's own method of accessing the values there (or
contantly accessing MVG's packet area via an indirect pointer).
There are samples in the MOD_CODE folder, showing how to read MVG's info
and call it's subroutines. A Number of macros also provide for ease of use.
The Packet Listing is documented there.
Method #2 incorporates a simple "function call" to perform a specific task
This is much the same way that GEMDOS calls are made, except that MVG is
not called using the TRAP opcode. Instead, JSR to PACK2_FUNC :
-------------------------------------------------------------------------
Sample Sample Sample Sample Sample Sample Sample Sample Sample Sample
-------------------------------------------------------------------------
move.l #2,-(sp) ;function #2, (get main_buffer address)
move.l PACK2_FUNC,(a0) ;point to function method address
jsr (a0) ;call MVG Function dispatcher
addq.l #4,sp ;restore stack_ptr
move.l d0,buffer_ptr ;save address of image buffer
move.l d1,buffer_len ;and also it's length
Each function is specified by a number. See M_METH2 file for
functions details.
-------------------------------------------------------------------------
Logical steps for module construction:
1) INIT
a) do standard prog init with free_mem etc
b) store pointer to "parent's" commandline. Label: PAR_whatever
c) check for MVG signature in parent commandline
1) if no sig, then exit
2) if sig found
a) check version number if necessary
b) or skip to packet read
2) PACKET Pointers
a) for method two, simply store the MVG_FUNC pointer somewhere...
b) for method one, copy the packet listing into module memory...
3) Build or point to necessary routines or system variables
a) most often, store adrs of main image buffer
b) 2nd most often, store adrs of clipboard buffer
c) other common vars: WID,HGT etc
4) Your program's MAIN_ACTION...........